#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dominion.h"

void testEndTurn(){
	int k[10] = {adventurer, council_room, feast, gardens, mine,
	       remodel, smithy, village, baron, great_hall};
	
	struct gameState *game = newGame();
	initializeGame(3, k, 10, game);
	struct gameState *test = malloc(sizeof(struct gameState));
	memcpy(test, game, sizeof(struct gameState));
	
	endTurn(test);
	if(test->whoseTurn == game->whoseTurn+1)
		printf("endTurn(): PASS turn incremented\n");
	else
		printf("endTurn(): FAIL turn didnt increate by 1\n");
	
	test->numActions = 0;
	test->numBuys = 0;
	
	int i;
	for(i = 1; i < test->numPlayers; ++i){
		endTurn(test);
	}
	
	if(test->whoseTurn == 0)
		printf("endTurn(): PASS turns restart after one full cycle\n");
	else
		printf("endTurn(): FAIL turn doesn't restart after one full cycle, %d\n", whoseTurn(test));
		
	if(test->numActions == 1)
		printf("endTurn(): PASS actions reset\n");
	else
		printf("endTurn(): FAIL actions nore reset\n");
		
	if(test->numBuys == 1)
		printf("endTurn(): PASS buys reset\n");
	else
		printf("endTurn(): FAIL buys reset\n");
}



int main(int argc, char *argv[]){
    testEndTurn();
    return 0;
}


